package cn.t222.controller;

import cn.t222.pojo.ItripHotelOrder;
import cn.t222.pojo.Result;
import cn.t222.service.OrderService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class OrderController {
    @Resource
    private OrderService orderService;

    @PostMapping
    public Result createOrder(ItripHotelOrder order) {
        String msg = orderService.createOrder(order);
        if("success".equals(msg)) {
            return Result.ok("200", msg, order);
        } else {
            return Result.error("500", msg, order);
        }
    }
}
